package com.nhutcm.trackingthief;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Window;
import android.view.WindowManager;

import com.nhutcm.trackingthief.adapter.PagerAdapter;
import com.nhutcm.trackingthief.utils.Constant;
import com.nhutcm.trackingthief.utils.RootUtils;

public class HomeScreen extends FragmentActivity {

	private ViewPager mViewPager;
	private PagerAdapter mPagerAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);

		RootUtils.deleteIfExist(Constant.CAMERA_CLICK_ORR);

		setContentView(R.layout.layout_main);

		mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), this);

		mViewPager = (ViewPager) findViewById(R.id.pager);
		mViewPager.setAdapter(mPagerAdapter);

		showTermOfUse();
	}

	void showTermOfUse() {
		AlertDialog.Builder alertDialog = new AlertDialog.Builder(
				HomeScreen.this);

		alertDialog.setMessage(getString(R.string.terms_of_use));

		alertDialog.setPositiveButton(getString(R.string.accept),
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int which) {
					}

				});

		alertDialog.show();
	}

	@Override
	public void onBackPressed() {
		startActivity(new Intent(this, RegisterScreen.class));
		overridePendingTransition(R.anim.trans_right_to_left_2,
				R.anim.trans_right_to_left_1);
		super.onBackPressed();
	}
}
